package bavaria.hightech.banking.bank;

import java.io.IOException;
import bavaria.hightech.banking.accounts.Account;
import bavaria.hightech.banking.exceptions.AccountNotAvailableException;
import bavaria.hightech.banking.exceptions.BankDoesNotExistException;
import bavaria.hightech.banking.exceptions.FixedDepositException;
import bavaria.hightech.banking.exceptions.GetStatementException;
import bavaria.hightech.banking.exceptions.NotEnoughMoneyException;
import bavaria.hightech.banking.exceptions.SortCriteriaMustNotBeNullException;
import bavaria.hightech.banking.money.Currency.currencyEnum;

/**
 * interface BankCustormerView
 * @author David
 *
 */
public interface BankCustomerView {

	/**
	 * Creates a new fixed deposit account. Increases the account number by one
	 * before doing that.
	 * 
	 * @param depositor
	 * @param conditionNr
	 * @return full account number
	 */
	public int createFixedDepositAcc(String depositor, int conditionNr);

	/**
	 * Creates a new fixed deposit account. Increases the account number by one
	 * before doing that.
	 * 
	 * @param depositor
	 * @param conditionNr
	 * @return full account number
	 */
	public int createGiroAcc(String depositor, int conditionNr);

	/**
	 * checks acc nr for validity. needs full acc nr.
	 * 
	 * @param accNr
	 *            acc nr >= firstAccNr
	 * @return boolean
	 */
	public boolean isValidAccNr(int accNr);

	public void modifyGiroCondition(int index, int interestHave, int interestIs)
			throws UnsupportedOperationException;

	public String[] getAllConditions();

	/**
	 * delivers balance
	 */
	public long getBalance(int accNr);

	/**
	 * adds money to an specific account
	 */
	public boolean addAmount(currencyEnum currency, int accNr, long amount,
			String reason);

	/**
	 * draws money from an specific account
	 */
	public boolean drawAmount(currencyEnum currency, int accNr, long amount,
			String reason) throws FixedDepositException;

	/**
	 * draw money from one and add it to another account
	 * 
	 * @throws FixedDepositException
	 * @throws BankDoesNotExistException
	 * @throws AccountNotAvailableException
	 * @throws NotEnoughMoneyException
	 */
	public void transferMoney(String receivingBank, currencyEnum currencyFrom,
			currencyEnum currencyTo, int accNr_From, int accNr_To, long amount,
			String reason) throws FixedDepositException,
			BankDoesNotExistException, AccountNotAvailableException,
			NotEnoughMoneyException;

	/**
	 * iterates over all accounts and applies interests
	 * 
	 * @return
	 * @throws FixedDepositException
	 */
	public void applyInterests() throws FixedDepositException;

	/**
	 * returns all information of all accounts
	 */
	public String[] listAccs();

	/**
	 * returns statement of an specific acc nr
	 * 
	 * @throws IOException
	 * @throws GetStatementException
	 */
	public void getStatement(int accNr, String mimeType, Integer sort,
			StringBuilderOutputStream stream)
			throws SortCriteriaMustNotBeNullException, IOException,
			GetStatementException;

	public boolean writeStreamToFile(StringBuilderOutputStream stream,
			String filename) throws IOException;

	boolean isValidAcc(Account acc);
}